#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <assert.h>

char* my_strstr(const char* source, const char* needle) {
	assert(source);
	assert(needle);
	char* cp = (char*)source;
	char* s1, *s2;

	if (!*needle)
		return 0;

	while (*cp) {
		s1 = cp;
		s2 = (char*)needle;

		while (*s1 && *s2 && !(*s1 - *s2))
			s1++, s2++;

		if (!*s2)
			return cp;

		cp++;
	}

	return NULL;
}

int main() {
	char arr1[] = "abcddef";
	char arr2[] = "def";
	char* p = my_strstr(arr1, arr2);

	if (p != NULL)
	{
		printf("%s", p);
	}
}